package com.supermap.business.product;

import com.alibaba.dubbo.config.annotation.Reference;
import com.supermap.dataservice.util.DateUtil;
import com.supermap.dataservice.util.JSONUtils;
import com.supermap.dubbo.api.annualService.AnnualService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @Author:zhoujian
 * @Desciption:周年服务方案
 * @date:2019-04-11 19:13
 * @version:v1.0.0
 */
@RestController
@RequestMapping("annualService")
public class AnnualServiceController {

    @Reference(timeout = 10000)
    AnnualService annualService;

    @GetMapping("productListByUserIdAndAreaCode")
    public JSONUtils selectProductListByUserIdAndAreaCode(@RequestParam(value="userId") String userId,
                                                          @RequestParam(value="areaCode") String areaCode)
    {
        return  annualService.selectProductListByUserAndAreaCode(userId,areaCode);
    }
    @GetMapping("currentDateProductDetailsById")
    public JSONUtils selectProductDetailsByIdAndDate(@RequestParam(value = "productId") Integer productId)
    {
        return annualService.selectProductDetailsByProductIdAndMonth(productId, DateUtil.DateToString(new Date(),"yyyy-MM-dd"));
    }
}